﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class GetOrderInfo : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {

        }
    }
    protected void btntj_Click(object sender, EventArgs e)
    {
       this.CreateOrder();
    }
    /// <summary>
    /// 创建订单
    /// </summary>
    public void CreateOrder()
    {
        string vehicle = txtvehicle.Text.Trim();
        bool isuseParts;
        bool isuseMachine;
        int state;
        if (radParts1.Checked)
        {
            isuseParts = true;
        }
        else
        {
            isuseParts = false;
        }
        if (radMac1.Checked)
        { isuseMachine = true; }
        else
        { isuseMachine = false; }
        switch (ddlstate.SelectedValue)
        {
            case "1": state = 1;
                break;
            case "2": state = 2;
                break;
            case "3": state = 3;
                break;
            default: state = 0;
                break;
        }
        SOAWebService.Service1 sows = new SOAWebService.Service1();
        string oId=sows.CreateOrder("nomeaning", vehicle, isuseParts, isuseMachine, state);
        if (oId!=null)
        {
            Session["orderId"] = oId;
            Response.Redirect("GetVehicleSerivce.aspx?orderId="+oId);
        }
        else
        {
            Response.Write("<script>alert('添加失败！');</script>");
        }
    }
}
